home *** CD-ROM | disk | FTP | other *** search
- @if-using not(ocl-file-delchar)
- @use (ocl-file-delchar)
- ;OCL{{{}}}
- ;OCL{{{ reference description
- @if-using ( FUN-REFERENCE ) ; 1 ;
- Libary, simulating some functions, deleted from Origami C-source.
- @fi
- ;OCL}}}
- ;OCL{{{ delete-character
- ;OCL{{{ reference
- @if-using ( FUN-REFERENCE ) ; 2 ; delete-character-ref
- ;OCL{{{ @delchar-ref delete-character
- Delete the character under the cursor. In overwrite mode, a space
- will replace the char.
- ;OCL}}}
- @fi
- ;OCL}}}
- ( defassembler delete-character
- (
- ;OCL{{{ test modes
- M_TEST_VIEW
- M_JMP_FALSE start
- M_EDITING
- M_JMP_TRUE start
-
- "@ ; view and not in prompt,
- M_END_MACRO ; this will call view hook!
- .start
- ;OCL}}}
- ;OCL{{{ join lines or delete inside
- M_LASTMES M_ERR_PO ; clear msg-tag
- M_END_OF_LINE
- M_JMP_FALSE do-del ; inside lines, delete
- M_EDITING
- M_JMP_TRUE ready ; do nothing in prompt
-
- ;OCL{{{ join lines
- ;OCL{{{ try
- .do-join O_DOWN
- M_SET_COUNTER (dummy0) 1 ; try to join lines
- M_GO_COUNTER_X_POS (dummy0)
- O_DELETE
- ;OCL}}}
- ;OCL{{{ check errors
- M_LASTMES M_ERR_PO
- M_JMP_TRUE join-line-error
- M_LASTMES M_LONG_LINE
- M_JMP_FALSE ready
- ;M_JMP long-line-error
-
- .long-line-error
- M_PROMPT -2 ( M_LONG_LINE ) M_END_MACRO
- M_END_MACRO
-
- .join-line-error
- O_UP ; joining lines failed
- O_END_OF_LINE
- M_JMP err
- ;OCL}}}
- ;OCL}}}
- ;OCL{{{ delete in line
- .do-del O_RIGHT ; go right and do the del
- O_DELETE
- M_LASTMES M_ERR_PO
- M_JMP_FALSE ready
- ;M_JMP in-line-error
- ;OCL}}}
- ;OCL{{{ handle error
- .in-line-error
- O_LEFT ; go back and report error
-
- .err M_PUSH_INT modify-behaviour
- M_SET_COUNTER modify-behaviour 2
- M_PROMPT -2 ( M_ERR_PO ) M_END_MACRO
- M_POP_INT modify-behaviour
- ;OCL}}}
- ;OCL}}}
- .ready
- )
- )
- ;OCL}}}
- ;OCL{{{ delete-to-end-of-line
- ;OCL{{{ reference
- @if-using ( FUN-REFERENCE ) ; 2 ; delete-to-end-of-line-ref
- ;OCL{{{ delete-to-end-of-line
- Delete all characters from current position to end of line. The
- deleted text is moved to the delete-buffer. If the cursor is in
- front of a closed fold, the complete fold will be removed.
- If OCL variable modify-behaviour is set to not null, the text will
- be killed, instead of deleted.
- ;OCL}}}
- @fi
- ;OCL}}}
- ( defvar ( dtoeol-x ) )
- ( deffun delete-to-end-of-line
- ( if in-prompt
- ;OCL{{{ simply delete all chars
- ( while not(test-end-line)
- ( forward-character
- delete-previous-character
- )
- )
- ;OCL}}}
- else
- ;OCL{{{ try to open line, to delete rest with delete-line!
- ( set dtoeol-x store-pos
- case
- ;OCL{{{ closed fold and in front of line -> move directly to {{
- ( or(test-fold-line test-filed)
- ( beginning-of-line
- if <(store-pos dtoeol-x) ( goto dtoeol-x ) fi
- )
- )
- ;OCL}}}
- ;OCL{{{ begin/end fold and in front of {{ -> crash
- ( or(test-begin-fold test-end-fold)
- ( beginning-of-line
- if >=(store-pos dtoeol-x)
- ( goto dtoeol-x "$ return-from-macro )
- else
- ( goto dtoeol-x )
- fi
- )
- )
- ;OCL}}}
- esac
- ;OCL{{{ splitt line and delete second part
- if last-message M_ERR_PO () fi
- newline-and-indent
- if and(not(test-view) not(last-message M_ERR_PO))
- ( if modify-behaviour ( kill-line ) else ( delete-line ) fi
- previous-line
- goto dtoeol-x
- )
- fi
- ;OCL}}}
- )
- ;OCL}}}
- fi
- )
- )
- ( undeclare ( dtoeol-x ) )
- ;OCL}}}
- @fi
-